{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("add")}-->
<button data-open='{:url("add")}?cate_id={$get_cate_id}' data-title="添加商品" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品</button>
<!--{/if}-->
<!--{if auth("remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除商品</button>
<!--{/if}-->
{/block}

{block name="content"}
{include file='store/goods/form_style'}
<div class="think-box-shadow">
    {include file='store/goods/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap' width="10%">商品信息</th>
            <th class='text-left nowrap layui-hide' width="10%">销售状态</th>
            <th class='text-left nowrap padding-0 relative' style="min-width:400px">
                <div class="layui-row" style="line-height:28px">
                    <div class="layui-col-xs2 text-center layui-elip">商品状态</div>
                    <div class="layui-col-xs2 text-center layui-elip">首页热门</div>
                    <div class="layui-col-xs2 text-center layui-elip layui-hide">活动折扣</div>
                    <div class="layui-col-xs2 text-center layui-elip layui-hide">会员折扣</div>
                    <div class="layui-col-xs2 text-center layui-elip">商品价格</div>
                    <div class="layui-col-xs2 text-center layui-elip">商品库存</div>
                    <div class="layui-col-xs2 text-center layui-elip">销售数量</div>
                </div>
            </th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
            <td class='text-left nowrap'>
                {notempty name='vo.logo'}
                <img data-tips-image style="width:60px;height:60px" src="{$vo.logo|default=''}" class="margin-right-5 text-top">
                {/notempty}
                <div class="inline-block">
                    商品编号：{$vo.id|default='--'}<br>
                    所属分类：{$vo.cate.title|default='--'}<br>
                    商品名称：{$vo.title|default='--'}<br>
                </div>
            </td>
            <td class='text-left nowrap layui-hide'>

                {eq name='vo.goods_number' value='0'}<span class="layui-badge">已售完</span>{else}<span class="layui-badge layui-bg-green">销售中</span>{/eq}<br>
            </td>
            <td class='text-left nowrap padding-0 relative'>
                <div style="overflow:auto;max-height:68px;padding:5px 0">

                    <div class="layui-row" style="line-height:23px">
                        <div class="layui-col-xs2 text-center layui-elip font-s10">
                            {if isset($vo.status) and $vo.status eq 1}
                            <!--{if auth("forbid")}-->
                            <a class="layui-btn layui-btn-sm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">上架中</a>
                            <!--{else}-->
                            <a data-tips-text="您没有下架商品的权限哦！" class="layui-btn layui-btn-sm layui-disabled">上架中</a>
                            <!--{/if}-->
                            {else}
                            <!--{if auth("resume")}-->
                            <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">已下架</a>
                            <!--{else}-->
                            <a data-tips-text="您没有上架商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">已下架</a>
                            <!--{/if}-->
                            {/if}

                        </div>
                        <div class="layui-col-xs2 text-center layui-elip font-s10">
                            {if isset($vo.is_hot) and $vo.is_hot eq 1}
                            <!--{if auth("no_hot")}-->
                            <a class="layui-btn layui-btn-sm" data-action="{:url('no_hot')}" data-value="id#{$vo.id};status#0">是</a>
                            <!--{else}-->
                            <a data-tips-text="您没有设置热销的权限哦！" class="layui-btn layui-btn-sm layui-disabled">是</a>
                            <!--{/if}-->
                            {else}
                            <!--{if auth("to_hot")}-->
                            <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('to_hot')}" data-value="id#{$vo.id};status#1">否</a>
                            <!--{else}-->
                            <a data-tips-text="您没有设置热销的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">否</a>
                            <!--{/if}-->
                            {/if}

                        </div>
                        <div class="layui-col-xs2 text-center layui-elip font-s10 layui-hide">
                            {if isset($vo.is_discount) and $vo.is_discount eq 1}
                            <!--{if auth("no_discount")}-->
                            <a class="layui-btn layui-btn-sm" data-action="{:url('no_discount')}" data-value="id#{$vo.id};status#0">是</a>
                            <!--{else}-->
                            <a data-tips-text="您没有设置折扣的权限哦！" class="layui-btn layui-btn-sm layui-disabled">是</a>
                            <!--{/if}-->
                            {else}
                            <!--{if auth("to_discount")}-->
                            <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('to_discount')}" data-value="id#{$vo.id};status#1">否</a>
                            <!--{else}-->
                            <a data-tips-text="您没有设置折扣的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">否</a>
                            <!--{/if}-->
                            {/if}

                        </div>
                        <div class="layui-col-xs2 text-center layui-elip font-s10 layui-hide">
                            {if isset($vo.is_member_discount) and $vo.is_member_discount eq 1}
                            <!--{if auth("no_member_discount")}-->
                            <a class="layui-btn layui-btn-sm" data-action="{:url('no_member_discount')}" data-value="id#{$vo.id};status#0">是</a>
                            <!--{else}-->
                            <a data-tips-text="您没有设置折扣的权限哦！" class="layui-btn layui-btn-sm layui-disabled">是</a>
                            <!--{/if}-->
                            {else}
                            <!--{if auth("to_member_discount")}-->
                            <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('to_member_discount')}" data-value="id#{$vo.id};status#1">否</a>
                            <!--{else}-->
                            <a data-tips-text="您没有设置折扣的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">否</a>
                            <!--{/if}-->
                            {/if}

                        </div>
                        <div class="layui-col-xs2 text-center layui-elip color-blue font-s10">{if $vo.is_discount == 1}{$vo.discount_price+0} / {/if}{$vo.goods_price+0}</div>
                        <div class="layui-col-xs2 text-center layui-elip color-blue font-s10">{$vo.goods_number+0}</div>
                        <div class="layui-col-xs2 text-center layui-elip color-blue font-s10">{$vo.number_sales+0}</div>
                    </div>

                </div>
            </td>
            <td class='text-left nowrap'>

                <div class="nowrap margin-bottom-5">
                    <a data-dbclick class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("data/store.GoodsAttr/index")}?goods_id={$vo.id}'>属性管理</a>

                    {if auth("edit")}
                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    {else}
                    <a data-tips-text="您没有编辑商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">编 辑</a>
                    {/if}

                    {if auth("remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                    {else}
                    <a data-tips-text="您没有删除商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">删 除</a>
                    {/if}

                </div>


            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
